<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>allEqualBy</title>
</head>

<body>
    <div>打开浏览器控制台查看结果</div>
    <script>
        const allEqualBy = (arr, fn) => arr.every(item => item === fn(arr[0]));
        console.log(allEqualBy([1.1, 1.2, 1.3], Math.round)); // true
        console.log(allEqualBy([1.1, 1.3, 1.6], Math.round)); // false
    </script>
</body>

</html>